package com.wu.flandre_api.api.page;

import com.wu.flandre_common.entity.RpcRequest;
import com.wu.flandre_api.components.ChannelUtil;
import com.wu.flandre_common.property.Constants;
import io.netty.channel.Channel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * IndexApi <br/>
 *
 * @author 50816 <br/>
 * @date 2019/12/22 15:37 <br/>
 */
@RestController
public class IndexApi {

    @GetMapping("/test/{name}")
    public String test(@PathVariable String name) {
        Channel channel = ChannelUtil.getInstance().getChannel();
        RpcRequest<String> request = new RpcRequest<>();
        request.setId(Constants.ENGINE_MAIL);
        request.setData(name);
        channel.writeAndFlush(request);
        return "OK";
    }
}
